<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        const promise = name => new Promise(resovle => {
            setTimeout(()=>{
                resovle()
                console.log(name)
            },1000)
        })

        promise('Promise').then(()=>promise('p2')).then(()=>{
            promise('p3')
        })
        const generator = function* (name){
            yield promise(name)
            yield promise(name)
        }

        const gen = generator('Generator')
        gen.next().value.then(()=>{
            gen.next()
        })
    </script>
</body>
</html>